package com.lzh.dlykserver.controller;

import com.lzh.dlykserver.result.NameValue;
import com.lzh.dlykserver.result.R;
import com.lzh.dlykserver.result.SummaryData;
import com.lzh.dlykserver.service.StatisticService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class StatisticController {

    @Resource
    private StatisticService statisticService;

    /**
     * 获取统计数据
     * @return
     */
    @GetMapping("/api/summary/data")
    public R getStatisticData() {
        SummaryData summaryData = statisticService.loadSummaryData();
        return R.OK(summaryData);
    }


    /**
     * 获取销售漏斗数据
     * @return
     */
    @GetMapping("/api/saleFunnerl/data")
    public R getSaleFunnelData() {

        List<NameValue> nameValueList = statisticService.getSaleFunnelData();
        return R.OK(nameValueList);
    }

    /**
     * 获取来源饼图数据
     * @return
     */
    @GetMapping("/api/sourcePie/data")
    public R getSourcePieData() {
        List<NameValue> nameValueList = statisticService.getSourcePieData();
        return R.OK(nameValueList);
    }

}
